"use strict";
/**
 * 枚举（Enum）类型用于取值被限定在一定范围内的场景
 * 采用关键字enum定义，例如enum Days{Sun, Mon, Wed, Thu, Fri, Sat}
 *
 * 枚举成员会被赋值为从0开始递增的数字
 *  同时也会被枚举值到枚举名进行方向映射
 */
exports.__esModule = true;
// 使用枚举可以定义一些有名字的数字常量
var Days;
(function (Days) {
    Days[Days["Sun"] = 3] = "Sun";
    Days[Days["Mon"] = 4] = "Mon";
    Days[Days["Tue"] = 5] = "Tue";
    Days[Days["Wed"] = 6] = "Wed";
    Days[Days["Thu"] = 7] = "Thu";
    Days[Days["Fri"] = 8] = "Fri";
    Days[Days["Sat"] = 9] = "Sat";
})(Days || (Days = {}));
(function (Days_1) {
    var Days;
    (function (Days) {
        Days[Days["Sun"] = 0] = "Sun";
        Days[Days["Mon"] = 1] = "Mon";
        Days[Days["Tue"] = 2] = "Tue";
        Days[Days["Wed"] = 3] = "Wed";
        Days[Days["Thu"] = 4] = "Thu";
        Days[Days["Fri"] = 5] = "Fri";
        Days[Days["Sat"] = 6] = "Sat";
    })(Days || (Days = {}));
})(Days || (Days = {}));
console.log(Days.Sun); //3
console.log(Days.Sat); //9
console.log(Days);
// 运行结果
// {
//   '3': 'Sun',
//   '4': 'Mon',
//   '5': 'Tue',
//   '6': 'Wed',
//   '7': 'Thu',
//   '8': 'Fri',
//   '9': 'Sat',
//   Sun: 3,
//   Mon: 4,
//   Tue: 5,
//   Wed: 6,
//   Thu: 7,
//   Fri: 8,
//   Sat: 9
// }
// 枚举类型会被编译成一个双向映射的对象
console.log(Days[0] === "Sun"); //false
console.log(Days[9] === "Sat"); //true
console.log(Days[4]); //Mon
